/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package servidor;

import org.omg.CORBA.ORB;
import org.omg.CosNaming.NamingContextExt;
import org.omg.CosNaming.NamingContextExtHelper;
import org.omg.PortableServer.POA;
import org.omg.PortableServer.POAHelper;
import sop_corba.OperarArreglosPOATie;

/**
 *
 * @author Juma Manuel Chaguendo
 */
public class ServidorArr {
    
    public ServidorArr()
    {
    }

    public static void main(String args[])
    {
        try
        {
            ORB orb = ORB.init(args, ((java.util.Properties) (null))); 
            
            POA poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
            poa.the_POAManager().activate();
            
            OperarArreglosImpl OperArrImpl = new OperarArreglosImpl(orb);
            OperarArreglosPOATie OperArrpoatie = new OperarArreglosPOATie(OperArrImpl);
            sop_corba.OperarArreglos OperArr = OperArrpoatie._this(orb);
            org.omg.CORBA.Object objeto = orb.resolve_initial_references("NameService");
            NamingContextExt namingcontextext = NamingContextExtHelper.narrow(objeto);
            String s = "oper_arr";
            org.omg.CosNaming.NameComponent anamecomponent[] = namingcontextext.to_name(s);
            namingcontextext.rebind(anamecomponent, OperArr);
            System.out.println("Servidor Iniciado");
            orb.run();
        }
        catch(Exception e)
        {
            System.out.println("Error de la Operacion"+e);
            e.printStackTrace(System.out);
        }
        System.out.println("Saliendo del Servidor");
    }
    
}
